package com.literature.search.file.service;


import com.literature.search.core.entity.EsFileObject;
import com.literature.search.core.entity.FileDocument;
import com.literature.search.core.entity.R.AjaxJson;
import com.literature.search.core.entity.esindex.HistoryKeywords;
import com.literature.search.file.entity.dto.SearchAllDTO;
import com.literature.search.file.entity.dto.SearchSingleDTO;
import com.literature.search.file.entity.dto.TopNDTO;
import com.literature.search.file.entity.vo.RecommendVO;
import org.elasticsearch.client.indices.AnalyzeResponse;

import java.io.IOException;
import java.util.List;


public interface IElasticService {




    /**
     * 精确根据文件id查询文档
     * @param id
     * @return
     */
    AjaxJson searchById(String id);

    AjaxJson searchAllByKeyword(SearchAllDTO searchAllDTO) throws IOException;

    Boolean existsIndex(String indexName);



    AjaxJson getIndexInfo();

    Boolean deleteById(String id);

    Boolean insert(EsFileObject fileObj) throws IOException;


    int count();

    AjaxJson searchSingle(SearchSingleDTO searchSingleDTO) throws IOException;

    int update(List<FileDocument> fileDocuments);

    Boolean deleteIndex();


    List<AnalyzeResponse.AnalyzeToken> analyze(String text);

    int insertHistoryKeywords(String userId,String fileName, Integer originHistoryKeywordsCount);

    List<HistoryKeywords> getHistoryKeywords();

    List<RecommendVO> recommendByRecentlyViewed();

    AjaxJson recommendHotDocument();

    List<RecommendVO> topN(TopNDTO topNDTO);
}
